From BlenderWiki

Jump to: navigation, search
Note: This is an archived version of the Blender Developer Wiki. The current and active wiki is available on wiki.blender.org.

Just Thinking Out Loud

Blender vs Python

With new event system, we can integrate tightly with Blender and get around what was essentially a problem of maintaining two separate databases.

Consider this scenario:

Blender starts, we start the python interpreter. The interpreter is now available for interesting start up tasks like parsing command line arguments or running some user-defined setup to connect to an external database

As Blender loads a .blend, we create a dictionary of proxy objects (name: pointer to PyObject). Only the key is set, the pointer is null. We will instantiate the PyObject if and when we actually need it (lazy initialization). Note that dictionary lookup is hashed and runs in constant time.

At this point, we have a python proxy object for every blender element we want to manipulate via python - not just the old favorites like Scenes and Cube.001 but also Windows, Contexts (for threading), event queues and whatever else we want to get our hands on. --Stivs 00:27, 28 February 2008 (CET)